import 'package:cook_dinner/config/include.dart';
import 'package:flutter/material.dart';

class LeftChat extends StatelessWidget {
  const LeftChat({Key? key, this.message}) : super(key: key);

  final String? message;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(top: 25.rpx, bottom: 45.rpx),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Image.asset(
            'assets/images/user_avatar.png',
            width: 52.rpx,
            height: 52.rpx,
          ),
          Container(
            margin: EdgeInsets.only(left: 15.rpx),
            padding: EdgeInsets.only(
              top: 13.rpx,
              right: 10.rpx,
              bottom: 13.rpx,
              left: 15.rpx,
            ),
            width: 210.rpx,
            decoration: BoxDecoration(
              color: const Color(0xffF2F2F2),
              borderRadius: BorderRadius.circular(10.rpx),
            ),
            child: Text(
              message ?? '',
              style: TextStyle(fontSize: 16.rpx, color: Colors.black),
            ),
          ),
        ],
      ),
    );
  }
}

class RightChat extends StatelessWidget {
  const RightChat({Key? key, this.message}) : super(key: key);

  final String? message;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(top: 25.rpx, bottom: 25.rpx),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          Container(
            margin: EdgeInsets.only(right: 15.rpx),
            padding: EdgeInsets.only(
              top: 13.rpx,
              right: 10.rpx,
              bottom: 13.rpx,
              left: 15.rpx,
            ),
            width: 210.rpx,
            decoration: BoxDecoration(
              color: const Color(0xff2C7EDB),
              borderRadius: BorderRadius.circular(10.rpx),
            ),
            child: Text(
              message ?? '',
              style: TextStyle(fontSize: 16.rpx, color: Colors.white),
            ),
          ),
          Image.asset(
            'assets/images/avartimg.png',
            width: 52.rpx,
            height: 52.rpx,
          ),
        ],
      ),
    );
  }
}

Widget time(time) {
  return Align(
    alignment: Alignment.center,
    child: Text(
      time,
      style: TextStyle(
        fontSize: 12.rpx,
        color: const Color(0xff999999),
      ),
    ),
  );
}
